Error trapping is a well-known shortcut in the art of error detection and correction. It is described, for example, in Peterson and Weldon, Error-Correcting Code, The MIT Press, 1984, at pages 237-240 and 364-367. Whenever applicable, error trapping obviates the need for the decoder to execute a highly sophisticated error correction algorithm, such as the Berlekamp key equation solver algorithm, as described in Berlekamp, Algebraic Coding Theory, McGraw-Hill, 1968, page 184, or the Welch-Berlekamp algorithm, which is the subject of U.S. Pat. No. 4,663,470 by Berlekamp and Welch, or the Euclidian algorithm. Avoiding the execution of such algorithms represents a significant savings in time and overhead.
The idea behind error trapping is this. Whenever a received codeword is such that all of its message symbols are correct and errors only appear in a few of the check symbols, shifting the entire received codeword through an encoder produces a set of new check symbols (or, more accurately, remainder symbols) which are all zero except those corresponding to received codeword check symbols having errors. (the term "new check symbols" as used herein is really a misnomer, since the symbols thus generated are actually "remainder" symbols defining the remainder left after dividing the entire received codeword by the code generator polynomial. The term "check symbol" usually connotes the remainder left after dividing only the message portion of the codeword by the code generator polynomial.) The new check symbols are precisely equal to the error pattern. Thus, error correction is trivially achieved by simply adding the non-zero new check symbols to the corresponding locations in the received codeword.
In order to trap errors occurring in the message portion of the received codeword, the encoder (typically a shift register having a number of feedback stages precisely equal to the number of check symbols in each codeword) is simply shifted until its contents are all zero except for a non-zero symbol pattern of no more than half (r/2) the total number (r) of check symbols. This non-zero symbol pattern is, by definition, the error pattern occurring in the corresponding shifted codeword locations. If the erroneous symbol occurs in the check portion of the received codeword, no shifting of the encoder register is necessary. If an error occurs in the last message symbol adjacent the check symbols, the encoder need be shifted only once. If the error occurs in the very first message location in the codeword, then the encoder must be shifted a number of times equal to the number of message symbols in the codeword in order to trap the error.